package A1动态规划;

public class LC_343整数拆分 {
    public static void main(String[] args){
        System.out.println(integerBreak(10));
    }
    public static int integerBreak(int n) {
        if(n==1||n==2)
            return 1;
        int[] dp=new int[n+1];
        dp[2]=1;
        for(int i=3;i<=n;i++)
            for(int j=1;j<=i/2;j++)
                dp[i]=Math.max(j*(i-j),Math.max(j*dp[i-j],dp[i]));
        return dp[n];
    }
}
